<template>
<div class="box-2">
    <h3>另一个子组件</h3>
    <p>电脑：{{ computer }}</p>
    <p>书籍：{{ book }}</p>
    <el-button @click="updateA($parent)">我要考研</el-button>
</div>
</template>

<script lang="ts" setup name="Grandson">
import { ref } from 'vue';


let computer = ref('华为')
let book = ref(6)

function updateA(parent:any){
    parent.a -= 1
}
defineExpose({computer,book})

</script>

<style scoped>
.box-2{
    background-color: rgb(163, 55, 154);
    padding: 20px;
    border-radius: 10px;
}
</style>